import Queue.MyQueue;

import java.util.ArrayList;
import java.util.Comparator;
import java.util.LinkedList;
import java.util.List;
import Queue.MyQueue;


class Card implements Comparable<Card> {
    public int rank;
    public String suit;

    public Card(int rank,String suit) {
        this.rank = rank;
        this.suit = suit;
    }

    @Override
    public int compareTo(Card o) {
        if(o == null) {
            return 1;
        }
        return rank - o.rank;
    }
}

class Student {
    private String name = "lch";
    public int age = 18;

    public Student() {
        System.out.println("Student()");
    }

    private Student(String name,int age) {
        this.name = name;
        this.age = age;

        System.out.println("Student(String name,int age)");
    }

    private void eat() {
        System.out.println("i am eat");
    }

    private void sleep() {
        System.out.println("i am pig");
    }


}

public class Test {
    public static void main(String[] args) {
        // 反射机制
        // 1. 通过getClass获取class对象
        Student studnt = new Student();
        Class c1 = studnt.getClass();
        // 2. 直接通过类名.class的方式得到，该方法最为可靠，程序性高
        Class c2 = Student.class;
        // 3. 通过class对象的forName（）静态方法获取
        Class c3 = null;
        try {
            c3 = Class.forName("Student");
        }catch (ClassNotFoundException e ) {
            e.printStackTrace();
        }
        System.out.println(c1.equals(c2));
    }
    public static void main4(String[] args) {
        Card a = new Card(1,"hello");
        Card b = new Card(2,"world");
        Card c = new Card(1,"world");


        System.out.println(a.compareTo(b));
        System.out.println(b.compareTo(c));
        System.out.println(a.compareTo(c));
    }
    public static void main3(String[] args) {
        MyQueue queue = new MyQueue();
        queue.offer(1);
        queue.offer(2);
        queue.offer(3);
        queue.offer(4);
        queue.offer(5);

        while(!queue.isEmpty()) {
            System.out.println(queue.size());
            System.out.println(queue.peek());
            queue.poll();
        }


    }

//    public static void main2(String[] args) {
//        Queue<Integer> q = new LinkedList<>();
//        q.offer(1);
//        q.offer(2);
//        q.offer(3);
//        q.offer(4);
//        q.offer(5);
//
//        System.out.println(q.size());
//        for(int e : q) {
//            System.out.println(e);
//        }
//        System.out.println();
//        // 默认是大堆
//        System.out.println(q.peek());
//        for(int e : q) {
//            System.out.println(e);
//        }
//
//        // 出队列
//        q.poll();
//    }
    public static void main1(String[] args) {
        List<String> list1 = new ArrayList<>();
        list1.add("Apple");
        list1.add("Banana");
        list1.add("Cherry");
        list1.add("Date");

        // 创建第二个集合
        List<String> list2 = new ArrayList<>();
        list2.add("Date");
        list2.add("Elderberry");
        list2.add("Banana");

        // 使用 addAll 将 list2 中的所有元素添加到 list1 中
        list1.addAll(list2);

        System.out.println(list1);
    }
}
